package tema8.ej05.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tema8.ej05.model.AficionDAO;
import tema8.ej05.model.bo.Aficion;

@WebServlet("/AficionCrear")
public class AficionCrearController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		request.getRequestDispatcher("/tema8/ej05/aficionCrear.jsp").forward(
				request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		AficionDAO aficionDAO = new AficionDAO();
		Aficion aficion= new Aficion(request.getParameter("nombre"));
		aficionDAO.crearAficion(aficion);
		request.getRequestDispatcher("/AficionRecuperar").forward(
				request, response);
		
	}
}
